package com.roy.sms.vo;

import com.roy.sms.model.Column;

public class ColumnVO {

	private int id;
	private String name;
	private String url;
	private String remark;
	private int type;
	private String typeText;
	private int pid;
	
	public ColumnVO() {

	}

	public ColumnVO(Column column) {
		id = column.getId();
		name = column.getName();
		url = column.getUrl();
		remark = column.getRemark();
		type = column.getType();
		setTypeText();
		setPid(column);
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getTypeText() {
		return typeText;
	}

	public int getPid() {
		return pid;
	}

	public void setPid(Column column) {
		if(column.getParentColumn() == null){
			if(column.getType() == Column.TYPE_FRANT){
				this.pid = -1;
			} else {
				this.pid = -2;
			}
		} else {
			this.pid = column.getParentColumn().getId();
		}
	}

	public void setPid(int pid) {
		this.pid = pid;
	}

	public void setTypeText() {
		if(type == Column.TYPE_FRANT){
			typeText = "前台";
		} else {
			typeText = "后台";
		}
	}
	
	public Column getColumn(){
		Column c = new Column();
		c.setId(id);
		c.setName(name);
		c.setRemark(remark);
		c.setType(type);
		c.setUrl(url);
		return c;
	}

}
